import React from 'react'
import axios from 'axios'
import { useState, useEffect } from 'react'
export default function App() {
  const [arr, setArr] = useState([])
  useEffect(() => {
    axios.get('http://localhost:3000/students').then((res) => {
      console.log('接口返回的数据为：', res.data);
      setArr(res.data)
    })
  }, [])
  return (
    <div>
      {
        arr.map((item, index) => {
          return (
            <li key={index}>姓名：{item.name}</li>
          )
        })
      }
    </div>
  )
}
